import { Injectable } from '@nestjs/common'
import { CreateSettingDto } from './dto/create-setting.dto'
import { UpdateSettingDto } from './dto/update-setting.dto'
import { PrismaService } from '../prisma/prisma.service'

@Injectable()
export class SettingService {
    constructor(private readonly prisma: PrismaService) { }

    create(createSettingDto: CreateSettingDto) {
        return this.prisma.setting.create({
            data: createSettingDto
        })
    }

    findAll() {
        return this.prisma.setting.findMany()
    }

    findOne(id: number) {
        return this.prisma.setting.findUnique({
            where: { id }
        })
    }

    update(id: number, updateSettingDto: UpdateSettingDto) {
        return this.prisma.setting.update({
            where: { id },
            data: updateSettingDto
        })
    }

    remove(id: number) {
        return this.prisma.setting.delete({
            where: { id }
        })
    }
}
